#ifndef CUSTOMFRAME_H
#define CUSTOMFRAME_H

#include <QFrame>
#include<QPainter>

class CustomFrame : public QFrame
{
    Q_OBJECT
public:
    CustomFrame(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
protected:
    void paintEvent(QPaintEvent *event) override {
        QFrame::paintEvent(event); // 先绘制默认框架

        QPainter painter(this);
        painter.setRenderHint(QPainter::Antialiasing);

        // 在框架上绘制自定义内容
        painter.setPen(Qt::blue);
        painter.drawText(rect(), Qt::AlignCenter, "Custom Frame");

        painter.setPen(QPen(Qt::red, 2));
        painter.drawEllipse(rect().adjusted(10, 10, -10, -10));
    }
};

#endif // CUSTOMFRAME_H
